﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Business.Models
{
    public class QuanTri
    {
        [Key]
        [ForeignKey("NhanVien")]
        public int IdNhanVien { get; set; }
        public bool QuanLy { get; set; }

        public virtual NhanVien NhanVien { get; set; }
    }

    public class QuanTriConfiguration : EntityTypeConfiguration<QuanTri>
    {

        public QuanTriConfiguration()
            : base()
        {

            HasKey(d => d.IdNhanVien);
            Property(d => d.IdNhanVien).
                HasColumnName("IdNhanVien").
                IsRequired();
            Property(d => d.QuanLy).
                HasColumnName("QuanLy").
                IsRequired();
            //HasRequired(x => x.nhanVien).
            //WithMany().
            //    Map(x => x.MapKey("IdGiaoVien"));
            ToTable("QuanTri", "dbo");
        }

    }
}